﻿
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ include file="../../common.jsp" %>
<%@ page import="java.util.StringTokenizer"%>
<%@ taglib uri="/page.util.gs.hitrust.com/taglibs/page" prefix="page"%>

<%@page import="system.LoginContext"%>
<%@page import="framework.core.SrvContext"%>
<html>
<head>
<title>产品不可采购可出库审批</title>
<META http-equiv=Content-Type content="text/html; charset=UTF-8">
<LINK href="<%=root%>/css/caigouxitong.css" type=text/css rel=stylesheet>
<SCRIPT language="JavaScript" src="<%=root%>/js/common.js"></SCRIPT>
<SCRIPT language="JavaScript" src="<%=root%>/js/calendar.js"></SCRIPT>
<SCRIPT language="JavaScript" src="<%=root%>/js/string.js"></SCRIPT>

<%
ArrayList deptList = new ArrayList();
ArrayList addrList = new ArrayList();

ArrayList ary = (ArrayList)request.getAttribute("organdaddr");

	ArrayList tManuf1 = (ArrayList)request.getAttribute("manufacture1");
	
	ResultProcess tOrder = (ResultProcess)request.getAttribute("maxStorageList");
	ArrayList tList = new ArrayList();
	String[] tStr = null;
%>

<script>
	var counter;
	var allprovider = new Array();

	<%
		//在此作出成功提示
		if(request.getAttribute("SUCCESSMSG") != null)
			out.print("alert('"+request.getAttribute("SUCCESSMSG")+"');");
	%>
	
	function query(pageSize){
		document.getElementById("myPageSize").value=pageSize;
		orderrauditform.action = "<%=response.encodeURL(root+"//A3000041.do")%>";
    	orderrauditform.submit();	
	}
  	
	
	function pass(){	
		var indexs = document.getElementsByName("indexs");
		var isSelected = false;
		for(i=0;i<indexs.length;i++){
			if(indexs[i].checked){
				isSelected = true;
				var val = document.getElementById("auditing"+i).value;
				if(val != "待审批"){
					alert("请选择待审批记录！");
					val = null;
					return false;
				}
			}	
				
		}
		if(isSelected != true) {
			alert("请至少选择一笔订单");
			return false;
		}

		if(confirm("是否确定审核通过？")){						
			document.pager.action = "<%=response.encodeURL(root+"/A3000042.do")%>";			
            document.pager.method="post";
			document.pager.submit();
		}else{
			return false;
		}
    	
	}
	
	function nopass(){
				var indexs = document.getElementsByName("indexs");
				var selectednum = 0;
				var orderids = new Array();
				for(i=0;i<indexs.length;i++){
					if(indexs[i].checked){
						orderids[selectednum] = indexs[i].value;
						selectednum++;
					}
					var val = document.getElementById("auditing"+i).value;
					if(val != "待审批"){
						alert("请选择待审批记录！");
						return false;
					}
				}
				/*
				if(selectednum > 1) {
					alert("请至多选择一笔申购单");
					return false;
				}
				*/
				if(selectednum < 1) {
					alert("请至少选择一笔申购单");
					return false;
				}
				if(confirm("是否确定审核不通过？")){						
					document.pager.action = "<%=response.encodeURL(root+"/A3000043.do")%>";			
		            document.pager.method="post";
					document.pager.submit();
				}else{
					return false;
				}
	}
	
	function exportExcel(){
		orderrauditform.action = "<%=response.encodeURL(root+"//A3000033.do")%>";
    	orderrauditform.submit();
	}

	function cls(){

		document.orderrauditform.m_concentricity_code.value = "";
		document.orderrauditform.m_product_name.value = "";
		document.orderrauditform.m_spec.value = "";
		document.orderrauditform.m_model.value = "";
		document.orderrauditform.m_drawing_piece_code.value = "";
		document.orderrauditform.m_provider_code.value = "";

		document.orderrauditform.m_auditing_status.options[0].selected=true;
		document.orderrauditform.m_status.options[0].selected=true;
		
	}
	
	
	function SelectAllCheckBox(){ 
		  if (document.all.indexs != null){ 
		    var OnOff = document.all.ckbox.checked; 
		    var theItem = document.getElementsByName("indexs"); 
		    if (theItem!=null){ 
		      if (typeof(theItem.value)=='undefined'){ 
		        var i; 
		        for (i=0;i < theItem.length; i++){ 
		          var SubItem = theItem[i]; 
		          SubItem.checked = OnOff; 
		        } 
		      }else{ 
		        theItem.checked = OnOff; 
		      } 
		    } 
		  }     
	    }
</script>
</head>



<body BGCOLOR="#f5f5f5"	text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="<%if("T".equals(request.getAttribute("ISQUERYCONDITIONEXIST"))){out.println("process('Q')");}%>">

<table width="98%" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr>
    <td height="20"> 
      <table width="100%" border="0" cellspacing="0" cellpadding="1">
        <tr height="20">
          <td height="20" width="1" class="mtxt_black">&nbsp;</td>
          <td height="30" width="758" class="mtxt_black">产品不可采购可出库审批</td>
        </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td class="bg_line" height="2"></td>
  </tr>
</table>

<br>


<form name="orderrauditform" method="get" >
<table width="98%" border="0" cellspacing="0" cellpadding="0" align="center">
	<tr> 
		<td> 
			<table class=bg_table id=tableId	cellspacing=1 cellpadding=0 style="padding-left:5;padding-right:5" width=100% align=center border=0>
				<tr height="20">
					<td  class="bg_column" align=center >启用日期：</td>
					<td align=left class="bg_row_odd" colspan="4">
							<%
                                 SimpleDateFormat bartDateFormat = new SimpleDateFormat("yyyy-MM-dd");
                                 Date d = new Date();
                                 String strNow = "";
                                 long l=(long)259200*(long)10000;
                                 Date d2 = new Date(System.currentTimeMillis());
                                 String strMothAgo = String.valueOf(bartDateFormat.format(d2));
                                    
                            %>  
                            
                     <%=framework.custom.UIManager.generateDateInput("m_EnabledTimeStart",
							request.getParameter("m_EnabledTimeStart")==null?strMothAgo:request.getParameter("m_EnabledTimeStart"))%>
					
					至
					<%=framework.custom.UIManager.generateDateInput("m_EnabledTimeEnd",
							request.getParameter("m_EnabledTimeEnd")==null?strNow:request.getParameter("m_EnabledTimeEnd"))%>
					
						
					</td>
				</tr>
				<TR height=20>
					<TD class="bg_column" align=center>集中编码：</TD>
					<TD align=left class="bg_row_odd" >
					<input type="text" name="m_concentricity_code" maxlength="20" value="<%=request.getParameter("m_concentricity_code")==null?"":request.getParameter("m_concentricity_code")%>">
					</TD>
                    <td class="bg_column" align=center>产品名称：</td>
                    <td align=left class="bg_row_odd" >
                    <input type="text" name="m_product_name" value="<%=request.getParameter("m_product_name")==null?"":request.getParameter("m_product_name") %>">
                    </td>
				</TR>
				
				<TR height=20>
					<TD class="bg_column" align=center>规&nbsp;&nbsp;&nbsp;&nbsp;格：</TD>
					<TD align=left class="bg_row_odd" >
					<input type="text" name="m_spec" maxlength="20" value="<%=request.getParameter("m_spec")==null?"":request.getParameter("m_spec") %>">
					</TD>
                    <td class="bg_column" align=center>型&nbsp;&nbsp;&nbsp;&nbsp;号：</td>
                    <td align=left class="bg_row_odd" >
                    <input type="text" name="m_model" value="<%=request.getParameter("m_model")==null?"":request.getParameter("m_model") %>">
                    </td>
				</TR>
				
				<TR height=20>
					<TD class="bg_column" align=center>图&nbsp;件&nbsp;号：</TD>
					<TD align=left class="bg_row_odd" >
					 <input type="text" name="m_drawing_piece_code" value="<%=request.getParameter("m_drawing_piece_code")==null?"":request.getParameter("m_drawing_piece_code") %>">
					</TD>
                    <td class="bg_column" align=center>供&nbsp;应&nbsp;商：</td>
                    <td align=left class="bg_row_odd" >
                    <input type="text" name="m_provider_code" value="<%=request.getParameter("m_provider_code")==null?"":request.getParameter("m_provider_code") %>">
                    </td>
				</TR>
				
				<TR height=20>				
					<TD class="bg_column" align=center>是否执行：</TD>
					<TD align=left class="bg_row_odd">
				         <select name="m_status">
		            	<option value="" <%=request.getParameter("m_status")==null?"selected":""%>>全部</option>
		            	<option value="1" <%="1".equals(request.getParameter("m_status"))?"selected":""%>>执行</option>
		            	<option value="0" <%="0".equals(request.getParameter("m_status"))?"selected":""%>>不执行</option>
		            </select>
					</TD>
					
					<TD class="bg_column" align=center>审批状态：</TD>
					<TD align=left class="bg_row_odd">
					 <select name="m_auditing_status">
		            	<option value="" <%=request.getParameter("m_auditing_status")==null?"selected":""%>>全部</option>
		            	<option value="0" <%="0".equals(request.getParameter("m_auditing_status"))?"selected":""%>>待审批</option>
		            	<option value="1" <%="1".equals(request.getParameter("m_auditing_status"))?"selected":""%>>已审批</option>
		            	<option value="2" <%="2".equals(request.getParameter("m_auditing_status"))?"selected":""%>>审批不通过</option>
		            </select>
					</TD>
                     	
				</TR>
													
													
			</table>
		</td>
	</tr>
    <tr>
            <%
                int totalRecords = 0;
                if(request.getAttribute("totalRecords")!=null){
                    totalRecords=Integer.parseInt((String)request.getAttribute("totalRecords"));
                }
                int defaultPageSize =10;
                if(request.getAttribute("pageSize")!=null){
                    defaultPageSize=Integer.parseInt((String)request.getAttribute("pageSize"));
                }
            %>          
            <page:pager total='<%=totalRecords%>' defaultPageSize='<%=defaultPageSize%>'></page:pager>
            <input type="hidden" value="<%=defaultPageSize%>" name="m_mypagesize" id="myPageSize" > 
            <% %>
    </tr>
</table>
</form>
    <p align="center">  
		<input type="button" class="kuang" value="查询" width="58" height="24" onclick="query(10)"/>&nbsp;
		<input type="button" class="kuang" value="清空" width="58" height="24" onclick="cls()"/>&nbsp;
    </p>
<%

	if(tOrder != null){
%>
	<center>
    <table width="98%" border="0" cellspacing="0" cellpadding="0" align="center">
		<tr>
			<td>
            <form name='pager' method="post">
			<input type="hidden" name='confirmorreject'>
            <input type='hidden' name='auditcontent' >
            	<table class=bg_table id=tableId	cellspacing=1 cellpadding=2 width=100% align=center border=0>
                    <tbody> 
                    <tr class="bg_column" height=20> 
                    	<td align=center class=top>
						<div class="txt_content"><input type="checkbox" name="ckbox" onClick="SelectAllCheckBox()"></div>
						</td> 
                        <td class=top align=center > 
                        <div align="center" class="txt_content">集中编码</div>
						</td>
                        <td class=top align=center > 
                        <div align="center" class="txt_content">产品名称</div>
						</td>
                       
                        <td class=top align=center > 
                        <div align="center" class="txt_content">规格</div>
						</td>
                        <td class=top align=center > 
                        <div align="center" class="txt_content">型号</div>
						</td>
                        <td class=top align=center > 
                        <div align="center" class="txt_content">图件号</div>
						</td>
                        <td class=top align=center > 
                        <div align="center" class="txt_content">供应商</div>
                        </td>
                        <td class=top align=center > 
                        <div align="center" class="txt_content">区域分类</div>
						</td>
                        <td class=top align=center > 
                        <div align="center" class="txt_content">招标分类</div>
						</td>
                        <td class=top align=center > 
                        <div align="center" class="txt_content">启用日期</div>
						</td>
                        <td class=top align=center > 
                        <div align="center" class="txt_content">是否执行</div>
						</td>
                        <td class=top align=center > 
                        <div align="center" class="txt_content">审批状态</div>
						</td> 
						<td class=top align=center > 
                        <div align="center" class="txt_content">创建人</div>
						</td>
						<td class=top align=center > 
                        <div align="center" class="txt_content">创建时间</div>
						</td> 
						<td class=top align=center > 
                        <div align="center" class="txt_content">审批人</div>
						</td> 
						<td class=top align=center > 
                        <div align="center" class="txt_content">审批时间</div>
						</td>                   
					</tr>
					<%
						tList = tOrder.getAllRecoreds();

						if(tList != null && tList.size() > 0){
						for(int i=0; i<tList.size(); i++){
							ProductUpdatePicVO tipTopVo = (ProductUpdatePicVO)tList.get(i);
							String tTempStr="";
							if(i%2==0){
								tTempStr="class=\"bg_row_odd\"";
							}else {
								tTempStr="class=\"bg_row_even\"";
							}

							
					%> 
					
							<tr <%=tTempStr%> height=20>
								<td class=top align=center > 
									<div align="center" class="txt_content">
									<input type="checkbox" id='checkboxs<%=i%>' name="indexs" value="<%=tipTopVo.id%>" >
									</div>
								</td>		
										
								<!--集中编码-->
								<td class=top align=center  > 								
									<div align="center" class="txt_content">
										<%=tipTopVo.getConcentricity_code()%>
									</div>
								</td>	
								<!--产品名称-->							
								<td class=top align=center > 
									<div align="center" class="txt_content">
									<%=tipTopVo.getName()%>
									</div>
								</td>
							
								<!--规格-->			
								<td class=top align=center > 
									<div align="center" class="txt_content">
									<%=tipTopVo.getSpec()%>
									</div>
								</td>	
								<!--型号-->			
								<td class=top align=center > 
									<div align="center" class="txt_content">
									<%=tipTopVo.getModel()%>
									</div>
								</td>	
								<!--图件号-->			
								<td class=top align=center > 
									<div align="center" class="txt_content">
									<%=tipTopVo.getM_drawing_piece_code()%>
									</div>
								</td>
                                <!--供应商-->           
                                <td class=top align=center > 
                                    <div align="center" class="txt_content">
                                   <%=tipTopVo.getProvidername()%>
                                    </div>
                                </td>   	
								<!--区域分类-->			
								<td class=top align=center > 
									<div align="center" class="txt_content">
									<%=tipTopVo.getAreatype()%>
									</div>
								</td>	
								<!--招标分类-->			
								<td class=top align=center > 							
									<div align="center" class="txt_content" id="">
									<%=tipTopVo.getType_name()%>
									</div>
                                    
								</td>	
																																							
								<!--启用日期-->			
								<td class=top align=center  > 
									<div align="center" class="txt_content" >
									<%=tipTopVo.getEnabled_time()%>
									</div>
								</td>	
								<!--是否启用-->

								<td class=top align=center> 
									<div align="center" class="txt_content"  >
									<%=tipTopVo.getStatus()%>
									</div>
								</td>
								<!--审批状态-->			
								<td class=top align=center  id='totalprice'> 
									<div align="center" class="txt_content" >
									<input type="hidden" id='auditing<%=i%>' value="<%=tipTopVo.getAuditing_status()%>" >
									<%=tipTopVo.getAuditing_status()%>
									</div>
								</td>
								<!--创建人-->			
								<td class=top align=center  id='totalprice'> 
									<div align="center" class="txt_content" >
									<%=tipTopVo.getCreate_user()%>
									</div>
								</td>
								<!--创建时间-->			
								<td class=top align=center  id='totalprice'> 
									<div align="center" class="txt_content" >
									<%=tipTopVo.getCreate_time()%>
									</div>
								</td>
								<!--审批人-->			
								<td class=top align=center  id='totalprice'> 
									<div align="center" class="txt_content" >
									<%=tipTopVo.getAuditing_user()%>
									</div>
								</td>
								<!--审批时间-->			
								<td class=top align=center  id='totalprice'> 
									<div align="center" class="txt_content" >
									<%=tipTopVo.getAuditing_time()%>
									</div>
								</td>
							</tr> 
						
							
					<%	
						}
					%>
						  <tr class="bg_column" height=20>
						    <td width="960" height="16" colspan="14" align="right">
									<!--导航条-->
						    		<page:navigator type='text' queryForm='orderrauditform'/>
						    </td>
						    <td colspan="2"  valign="middle" align="center"><img width="11" height="14" src="/gw/framework/images/list/m17.gif" title="每页10行" name="select_psize"  onclick="query(10);return false;" style="CURSOR: hand">10行
						    <img width="11" height="14" src="/gw/framework/images/list/m18.gif" title="每页20行" onclick="query(20);return false;" style="CURSOR: hand">20行
						    <img width="11" height="14" src="/gw/framework/images/list/m19.gif" title="每页50行" onclick="query(50);return false;" style="CURSOR: hand">50行</td>
						  </tr>
				    <%
						}else{
					%>
                            <tr class="bg_column" height=20>
                            <td width="960" height="16" colspan="19" align="center"
                               ><font color="red">没有符合条件的产品不可采购可出库审批信息,请重新输入查询条件</font></td>
                            </tr>
					<%
						}
					%>
					</tbody>
				</table>
				</form>					  
			</td>
		</tr>
	</table>
	</center>
		<p align="center">  
    
		<p align="center">  
    	<input type=button value="设置审批通过" class="buttons" onclick="pass();return false;">
    	<input type=button value="设置审批不通过 " class="buttons" onclick="nopass();return false;">
		<input type=button value="导出excel" class="buttons" onclick="exportExcel();return false;">
         	
    </p>
	<%} %>

       
   
	
<%		
	
	if(tOrder == null && request.getAttribute("ISQUERYCONDITIONEXIST") != null && request.getAttribute("ISQUERYCONDITIONEXIST").equals("T")){
%>
		<font size="2">数据查询中......</font>
<%
	}
%>

</body>
</html>